package com.bookstore.dto;

import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Data
public class OrderDTO {
    private Long id;
    private Long userId;
    private BigDecimal totalAmount;
    private String status;
    private String address;
    private String phone;
    private LocalDateTime createdAt;
    private int totalQuantity;
    private String orderNumber;
    
    // 添加支付方式字段
    private String paymentMethod;
    
    // 添加支付时间字段
    private LocalDateTime payTime;
    
    // 添加发货时间字段
    private LocalDateTime shipTime;
    
    // 添加完成时间字段
    private LocalDateTime completeTime;
    
    // 添加订单过期时间字段
    private LocalDateTime expireTime;
    
    // 添加订单备注字段
    private String remark;
    
    // 添加配送费字段
    private BigDecimal deliveryFee;
    
    private List<OrderItemDTO> items;

    public int getTotalQuantity() {
        return items.stream().mapToInt(d->d.getQuantity()).sum();
    }
}